package cur.nature.component.nacos.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.reactive.function.client.WebClient;

@Component
@ConditionalOnProperty( value = {"cur.component.nacos.enable"})
public class MicroClient{
    private static RestTemplate restTemplate;

    private static WebClient _webClient;

    public MicroClient(WebClient webClient) {
        _webClient = webClient;
    }

    public static WebClient inst() {return _webClient;}

    public static WebClient.RequestHeadersUriSpec<?> get() {
        return _webClient.get();
    }

    public static WebClient.RequestHeadersUriSpec<?> head() {
        return _webClient.head();
    }

    public static WebClient.RequestBodyUriSpec post() {
        return _webClient.post();
    }

    public static WebClient.RequestBodyUriSpec put() {
        return _webClient.put();
    }

    public static WebClient.RequestBodyUriSpec patch() {
        return _webClient.patch();
    }

    public static WebClient.RequestHeadersUriSpec<?> delete() {
        return _webClient.delete();
    }

    public static WebClient.RequestHeadersUriSpec<?> options() {
        return _webClient.options();
    }

    public static WebClient.RequestBodyUriSpec method(HttpMethod method) {
        return _webClient.method(method);
    }

    public static WebClient.Builder mutate() {
        return _webClient.mutate();
    }
}
